module.exports =
  Component({
    properties: {
      title: {
        type: String,
        value: ''
      },
      width: {
        type: String,
        value: '650rpx'
      },
      opacity: {
        type: Number,
        value: 0.4
      },
      closeOnClickModal: {
        type: Boolean,
        value: false
      },
      animation: {
        type: Boolean,
        value: false
      },
      confirmText: {
        type: String,
        value: '确定'
      },
      cancelText: {
        type: String,
        value: '取消'
      },
      confirmColor: {
        type: String,
        value: '#333'
      },
      cancelColor: {
        type: String,
        value: '#ffd444'
      },
      showConfirm: {
        type: Boolean,
        value: true
      },
      showCancel: {
        type: Boolean,
        value: true
      },
      confirmBackgroundColor: {
        type: String,
        value: '#ffd444'
      },
      cancelBackgroundColor: {
        type: String,
        value: '#ffffff'
      }
    },
    data: {
      position: 'center'
    },
    methods: {
      close() {
        this.triggerEvent('close');
      },
      cancel() {
        this.triggerEvent('cancel');
      },
      confirm() {
        this.triggerEvent('confirm');
      },
      touchMask() {
        if (this.data.closeOnClickModal) {
          this.close();
        }
      }
    }
  });